//
//  FindController.m
//  XMLYFM
//
//  Created by dllo on 15/12/22.
//  Copyright © 2015年 zzl. All rights reserved.
//

#import "FindController.h"
#import "ZTRecommendViewController.h"
#import "ZTListViewController.h"
#import "ZTAnchorViewController.h"

#define WIDTH [[UIScreen mainScreen] bounds].size.width

#define HEIGHT [[UIScreen mainScreen] bounds].size.height

@interface FindController () <UIScrollViewDelegate>

@property (nonatomic, strong) ZTRecommendViewController *recommendVC;

@property (nonatomic, strong) ZTListViewController *listVC;

@property (nonatomic, strong) ZTAnchorViewController *anchorVC;

@property (nonatomic, retain) UIScrollView *bigScrollView;

@property (nonatomic, retain) UIView *topView;

@end

@implementation FindController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];

#pragma mark - 设置首页切换下的横条
    self.topView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, 40)];
    [self.view addSubview:self.topView];
    self.topView.backgroundColor = [UIColor whiteColor];
    
    
#pragma mark - 创建ScrollView
    self.bigScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 40, WIDTH, HEIGHT)];
    self.bigScrollView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:self.bigScrollView];
    // 横滚
    self.bigScrollView.contentSize = CGSizeMake(WIDTH * 3, 0);
    // 设置按页滑动(相册刹车)
    self.bigScrollView.pagingEnabled = YES;
    // 是否边界反弹
    self.bigScrollView.bounces = NO;
    // 是否显示滑动条(水平)
    self.bigScrollView.showsHorizontalScrollIndicator = NO;
    self.bigScrollView.delegate = self;
    
    
    
    
#pragma mark - 创建三个viewController
    self.anchorVC = [[ZTAnchorViewController alloc] init];
    // 设置容器视图控制器
    [self addChildViewController:self.anchorVC];
    self.anchorVC.view.frame = CGRectMake(WIDTH * 2, 0, WIDTH, HEIGHT);
    [self.bigScrollView addSubview:self.anchorVC.view];
    
    self.listVC = [[ZTListViewController alloc] init];
    // 设置容器视图控制器
    [self addChildViewController:self.listVC];
    self.listVC.view.frame = CGRectMake(WIDTH, 0, WIDTH, HEIGHT);
    [self.bigScrollView addSubview:self.listVC.view];
    
    self.recommendVC = [[ZTRecommendViewController alloc] init];
    // 设置容器视图控制器
    [self addChildViewController:self.recommendVC];
    self.recommendVC.view.frame = CGRectMake(0, 0, WIDTH, HEIGHT);
    [self.bigScrollView addSubview:self.recommendVC.view];
    

    

    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
